#include "gpio.h"
#include "print.h"

#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>

static uint32_t mock_gpio = 0;

void app_print(const char *fmt, ...)
{
    va_list args;
    char buf_temp[4096];

	va_start(args, fmt);
    int len = vsprintf(buf_temp, fmt, args);
    va_end(args);

    printf("%s", buf_temp);
}

void write_gpio(uint32_t gpio, uint32_t level)
{
    if (level == 0) {
        mock_gpio &= ~(1 << gpio);
    } else {
        mock_gpio |= (1 << gpio);
    }
}

uint32_t read_gpio(uint32_t gpio)
{
	return mock_gpio & (1 << gpio);
}

void reset_gpio(void )
{
	mock_gpio = 0;
}